package com.kgis.map.control.ui {
   import flash.display.Bitmap;
   import flash.display.Sprite;

   import com.kgis.map.geometry.basetype.Pixel;
   import com.kgis.map.geometry.basetype.Size;

   /**
    * Class extending Sprite.
    * It allows to create a button in pure AS3.
    */
   public class ImageButton extends Sprite {
      private var _image:Bitmap = null;

      public function ImageButton(name:String, image:Bitmap, xy:Pixel, sz:Size = null) {
         super();

         this._image = image;

         this.buttonMode = true;
         this.useHandCursor = true;

         this.addChild(this._image);

         this.x = xy.x;
         this.y = xy.y;
         this.name = name;

         if (sz != null) {
            this.width = sz.w;
            this.height = sz.h;
         }
         else {
            this.width = image.width;
            this.height = image.height;
         }

      }

   }
}

